![]() |
FindControlUnderMouse |
||||
Header: | Controls.h | Carbon status: | Supported | |
Obtains the location of a mouse-down event in a control.
ControlRef FindControlUnderMouse ( Point inWhere, WindowRef inWindow, SInt16 *outPart );
A point, specified in coordinates local to the window, where the mouse-down event occurred. Before calling FindControlUnderMouse, use the QuickDraw GlobalToLocal function to convert the point stored in the where field of the event structure (which describes the location of the mouse-down event) to coordinates local to the window.
A pointer to the window in which the mouse-down event occurred.
On input, a pointer to a signed 16-bit integer value. On return, the value is set to the part code of the control part that was selected; see
A handle to the control that was selected. If the mouse-down event did not occur over a control part, FindControlUnderMouse returns NULL.
You should call the FindControlUnderMouse function instead of FindControl to determine whether a mouse-down event occurred in a control, particularly if an embedding hierarchy is present. FindControlUnderMouse will return a handle to the control even if no part was hit and can determine whether a mouse-down event has occurred even if the control is deactivated, while FindControl does not.
When a mouse-down event occurs, your application should call FindControlUnderMouse after using the Window Manager function FindWindow to ascertain that a mouse-down event has occurred in the content region of a window containing controls.
This function is available with Appearance Manager 1.0 and later.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)